/*
Description of program:
use UMICH survey for inflation expectations
*/

clear

local inputs_dir "C:\Users\yuxus\Dropbox\PROJECTS (ACTIVE)\Bond.Risk.Premia.Mitra.Xu\Data\PRIOR_TO_RFS_RR\combined_results_yu\data"

cd "C:\Users\yuxus\Dropbox\PROJECTS (ACTIVE)\Bond.Risk.Premia.Mitra.Xu\RFS manuscript and replication packet\replication\empirical results\Figure1_replication"

/* ----------------------------------------------------------------------------------------------------------------------------------------------------------
1. set up data
---------------------------------------------------------------------------------------------------------------------------------------------------------- */

cd "`outputs_dir'"

* gsw nominal bonds
use "`inputs_dir'\gsw_daily_ytm.dta"
// rename date dated

* convert to monthly, using month end prices

gen D = day(dated)
gen M = month(dated)
gen Y = year(dated)
gen datem = ym(Y,M)
format datem %tm

egen max_D = max(D), by(datem)
keep if D==max_D

* monthly MICH inflation expectations
merge 1:1 datem using "`inputs_dir'\MICH.dta"
keep if _merge!=2
drop _merge

/* ----------------------------------------------------------------------------------------------------------------------------------------------------------
2. short rate measure 1
---------------------------------------------------------------------------------------------------------------------------------------------------------- */

gen TIPS_1Y_MICH = SVENY01 - MICH

keep datem TIPS_1Y_MICH

save "TIPS_1Y_PROXY.dta", replace